<%--
  Created by IntelliJ IDEA.
  User: limin
  Date: 2021/8/10
  Time: 16:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">

    <title></title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">

    <link rel="stylesheet" type="text/css" href="css/maintable.css" >
    <style>
        .div_tools {
            width: 99.5%;
            height: 28px;
            background: #D3EAEF;
            margin: 0px auto;
            margin-top: 5px;
            margin-bottom: 5px;
            font-size: 12px;
            position: relative;
        }

        .div_tools select {
            height: 22px;
            font-size: 12px;
            margin-top: 3px;
        }

        #btnsubmit {
            width: 40px;
            height: 20px;
            font-size: 12px;
        }
    </style>
    <script type="text/javascript" src="js/jquery-1.8.0.js"></script>
    <script src="js/My97DatePicker/WdatePicker.js"></script>
    <script>
        function subForm(){
            $("#pageIndex").val("1")
            document.form1.submit();
        }
    </script>
</head>

<body>
<div class ="div_title">
    <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>订单列表</span></div>
    <div class="div_titleoper">
        <input type="checkbox" id="top_ch_checkall"/> 全选 <a href="admin_add.jsp"> <img src="images/add.gif"/>添加 </a> <a href="javascript:void(0)"><img src="images/del.gif"/>删除</a> </div>
</div>
<form action="OrderServlet.do?flag=manage" method="post" name="form1">
<div class="div_tools">
    <span>订单号：</span> <input type="text" name="orderNo" value="${orderNo}">
    <span>下单日期：</span> <input onclick="WdatePicker()" name="beginDate" value="${beginDate}">
    <span>到</span>
    <input onclick="WdatePicker()" name="endDate" value="${endDate}">
    <select name="orderState" id="orderState">
        <option value="">全部</option>
        <c:forEach var="state" items="${orderStateList}">
            <option value="${state.value}">${state}</option>
        </c:forEach>
    </select>
    <input type="submit" value="查询" onclick="subForm()">
</div>

<table class="main_table">
    <tr>
        <th><input type="checkbox" id="ch_checkall" /></th>
        <th>订单号</th>
        <th>付款方式</th>
        <th>订单金额</th>
        <th>订单状态</th>
        <th>邮寄方式</th>
        <th>生成日期</th>
        <th>发货地址</th>
        <th>操作</th>
    </tr>
    <c:forEach var="order" items="${orderList}">
        <tr>
            <td>
                <input type="checkbox" name="ck_id" value="69" />
            </td>
            <td>${order.orderNo}</td>
            <td>${order.payMethod}</td>
            <td>${order.amount}</td>
            <td>${order.orderState}</td>
            <td>${order.postMethod}</td>
            <td>${order.orderDate}</td>
            <td>${order.address}</td>
            <td>
                <a href="OrderServlet.do?flag=toOrderDetails&id=${order.id}">查看</a>
                <c:if test="${order.orderState == '已支付'}">
                <a href="OrderServlet.do?flag=updateState&id=${order.id}&pageIndex=${page.pageIndex}"  onclick="return confirm('确认发货吗')">发货</a>
                </c:if>
            </td>
        </tr>
    </c:forEach>

</table>

<div class="div_page" >
    <div class="div_page_left">    共有 <label>${page.rowCount }</label> 条记录，当前第 <label>${page.pageIndex }</label> 页，共 <label>${page.pageCount } 页</label> 页	</div>
    <div class="div_page_right" >
        <c:if test="${page.pageIndex != 1 }">
            <a href="OrderServlet.do?flag=manage&pageIndex=1">首页</a>
            <a href="OrderServlet.do?flag=manage&pageIndex=${ page.pageIndex-1 }">上一页</a>
        </c:if>
        <c:if test="${page.pageIndex != page.pageCount }">
            <a href="OrderServlet.do?flag=manage&pageIndex=${ page.pageIndex+1 }">下一页</a>
            <a href="OrderServlet.do?flag=manage&pageIndex=${page.pageCount }">尾页</a>
        </c:if>
        <input type=submit value="转到第" > <input id="pageIndex" name="pageIndex" value="${page.pageIndex }" > 页
    </div>

</div>
</form>
${msg}
</body>
</html>
